package org.czl.study.config;

import org.apache.cxf.Bus;
import org.apache.cxf.jaxws.EndpointImpl;
import org.czl.study.service.IDemoService;
import org.czl.study.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.xml.ws.Endpoint;


@Configuration
public class CxfConfig {
    @Autowired
    private Bus bus;
    @Autowired
    private IDemoService demoService;


    // 访问地址 http://127.0.0.1:8080/soap/hello?wsdl
    @Bean
    public Endpoint endpoint() {
        EndpointImpl endpoint = new EndpointImpl(bus, demoService);
        endpoint.publish("/hello");    //发布地址
        return endpoint;
    }

    @Bean
    public Endpoint endpoint(IUserService userService) {
        EndpointImpl endpoint = new EndpointImpl(bus, userService);//绑定要发布的服务
        endpoint.publish("/user"); //显示要发布的名称
        return endpoint;
    }
}

